from crepe import predict

class MusicTranscriber:
    def transcribe(self, audio_file):
        """使用CREPE模型进行音高检测"""
        time, frequency, confidence, activation = predict(audio_file, viterbi=True)
        return {
            "pitch": frequency.tolist(),
            "confidence": confidence.tolist()
        }